<?php


class Javascript {


    public static $needJQuery=false;
    public static $scripts=array();
    public static $liens=array();
    
    
    
    public static function addSomeScript($script, $needJQuery=false){
        if($needJQuery) self::$needJQuery=true;
        self::$scripts[]=$script;
    }
    
    public static function addFileScript($lien, $needJQuery=false){
        if($needJQuery) self::$needJQuery=true;
        self::$liens[]=$lien;
    }
    
    
    
    public static function getScripts(){
        $retour='';
        if(self::$needJQuery){
            $retour='<script src="static/js/jquery-1.11.0.js"></script>';
        }
        foreach(self::$liens as $lien){
            $retour.='<script src="static/js/'.$lien.'"></script>'.PHP_EOL;
        }
        if(count(self::$scripts)!=0){
            $retour.='<script>'.PHP_EOL;
            foreach(self::$scripts as $script){
                $retour.=$script.PHP_EOL;
            }
            $retour.='</script>'.PHP_EOL;
        }
        return $retour;
    }


}


?>